home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 10 - 1994 / 10.10 Oct 94 / Sprocket / Interfaces / AppLib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-25  |  3.4 KB  |  149 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        AppLib.h
  3.  
  4.     Contains:    Prototypes for the “guts” of a Macintosh application.
  5.  
  6.     Written by: Dave Falkenburg
  7.  
  8.     Copyright:    © 1993 by Dave Falkenburg, all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.      
  12.  */
  13.  
  14. #ifndef        _APPLIB_
  15. #define        _APPLIB_
  16.  
  17. #include    "AppConditionals.h"
  18. #include    "Preferences.h"
  19.  
  20. #include    <Types.h>
  21. #include    <Windows.h>
  22. #include    <Dialogs.h>
  23. #include    <Menus.h>
  24. #include    <Files.h>
  25. #include    <AppleEvents.h>
  26. #include    <StandardFile.h>
  27. #include    <OCEStandardMail.h>
  28.  
  29. #include    "Window.h"
  30.  
  31. #if    qUseQuickDrawGX
  32. #include    <FixMath.h>            //    make sure we don’t use GX lame #define of “fixed1”
  33. #include    <graphics types.h>
  34. #endif
  35.  
  36. //    useful macros
  37.  
  38. #if    qDebug
  39. #define    DebugMessage(x)    DebugStr(x)
  40. #else
  41. #define    DebugMessage(x)
  42. #endif
  43.  
  44. //    Resource IDs
  45.  
  46. #define    kErrorAlertID                        128
  47. #define    kStandardCloseAlertID                129
  48. #define    kStandardCloseWithNewPubsAlertID    130
  49.  
  50. #define    kCoreErrorStrings                    128
  51. #define    kUnsupportedSystemSoftware            1
  52. #define    kNeedsThreadManager                    2
  53.  
  54. #define    kStandardCloseStrings                129
  55. #define    kQuittingStr                        1
  56. #define    kClosingStr                            2
  57.  
  58. #define    kPreferencesFileStrings                130
  59. #define    kPreferencesFileName                1
  60.  
  61. #define    kSplashPictureID                    128
  62.  
  63.  
  64. #if        qUseQuickDrawGX
  65.  
  66. //    When using GX, we want to create a 300K graphics heap
  67. //    NOTE: I have no idea what to use as a number here!
  68.  
  69. #define    kGraphicsHeapSize        (300 * 1024)
  70.  
  71. #endif
  72.  
  73.  
  74. //    Useful functions provided by App:
  75.  
  76. void                    HandleEvent(EventRecord *anEvent);
  77. void                    HandleClose(WindowPtr aWindow);
  78.  
  79. short                    StandardAlert(    short alertID,
  80.                                         short defaultItem                = ok,
  81.                                         short cancelItem                = 0,
  82.                                         ModalFilterUPP customFilterProc    = nil);
  83.  
  84. void                    ErrorAlert(short stringList,short whichString);
  85. void                    FatalErrorAlert(short stringList,short whichString);
  86.  
  87. extern ModalFilterUPP    StandardDialogFilter;
  88. extern ModalFilterYDUPP    StandardDialogFilterYD;
  89. extern    void            PseudoClickInDialogItem(DialogPtr theDialog, short itemToClick);
  90.  
  91. enum    StandardCloseResult
  92.     {
  93.     kSaveDocument = 1,
  94.     kCancelSaveDocument = 2,
  95.     kDontSaveDocument = 3
  96.     };
  97.  
  98. StandardCloseResult        StandardCloseDocument(const StringPtr documentType,StringPtr documentName, Boolean hasNewEditions, Boolean quitting);
  99.  
  100. OSErr                    CheckAppleEventForMissingParams(AppleEvent *theAppleEvent);
  101.  
  102. short                    OpenPreferencesResFile(void);
  103.  
  104. //    AOCE “FrontWindow”-equivalent routine for the Standard Mail package
  105. extern FrontWindowUPP    FrontWindowProcForAOCEUPP;
  106.  
  107. //    Globals
  108.  
  109. extern    Boolean                gDone;
  110. extern    Boolean                gMenuBarNeedsUpdate;
  111.  
  112. extern    Boolean                gHasColorQuickdraw;
  113. extern    Boolean                gHasThreadManager;
  114. extern    Boolean                gHasDragManager;
  115. extern    Boolean                gHasAOCE;
  116. extern    Boolean                gHasDisplayManager;
  117.  
  118. #if    qInlineInputAware
  119. extern    Boolean                gHasTextServices;
  120. extern    Boolean                gHasTSMTE;
  121. #endif
  122.  
  123. #if    qUseQuickDrawGX
  124. extern    Boolean                gHasQuickDrawGX;
  125. extern    long                gQuickDrawGXVersion;
  126. extern    long                gQuickDrawGXPrintingVersion;
  127. extern    gxGraphicsClient    gQuickDrawGXClient;
  128. #endif
  129.  
  130. extern    GrafPtr                gWindowManagerPort;
  131. extern    Rect                gDeskRectangle;
  132. extern    RgnHandle            gMouseRegion;
  133.  
  134. extern    short                gPreferencesRsrcRefNum;
  135.  
  136. //    Routines that the application MUST supply:
  137.  
  138. extern    OSErr    SetupApplication(void);
  139. extern    void    TearDownApplication(void);
  140. extern    void    HandleMenu(TWindow * topWindowObj,long menuCode);
  141. extern    void    ConvertClipboard(void);
  142.  
  143. extern    OSErr    OpenNewDocument(void);
  144. extern    OSErr    OpenDocument(LetterDescriptor *,void *);
  145. extern    OSErr    PrintDocument(LetterDescriptor *,void *);
  146. extern    Boolean    QuitApplication(void);
  147.  
  148. #endif
  149.